times=int(input())
for i in range(times):
inp=input().split()
n=int(inp[0])
k=int(inp[1])
can=True
arr=input().split()
pos=input().split()
seconds_sum=[0]*n
point=0
for j in range(n):
arr[j]=int(arr[j])
pos[j]=int(pos[j])
for j in range(n):
seconds_sum[abs(pos[j])-1]+=arr[j]
sum=0
for j in range(1,n+1):
sum+=seconds_sum[j-1]
if sum>j*k: can=False
if(can):
print("YES")
else:
print("NO")
#include<bits/stdc++.h>
using namespace std;
#define ans(val) cout<<val<<endl;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define input_vec(vec,n) for(int i = 0; i < n; i++) { cin >> vec[i]; }
#define deb_vec(vec) for(int i = 0; i < vec.size(); i++) { cout << vec[i] << ' '; }
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
uniform_int_distribution<int> uid(0,lim-1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================
vi g[N];
int a[N];
string DecimalToBinary(int num)
{
string str;
while(num){
if(num & 1) // 1
str+='1';
else // 0
str+='0';
num>>=1; // Right Shift by 1
}
return str;
}
void solve() {
ll k, n, dam_avail= 0, flag = 1, dam_given = 0;
cin>>n>>k;
vector<int> v(n);
vector<int> x(n);
map<int,int> mp;
// deb(n);
// deb(k);
input_vec(v,n);
input_vec(x,n);
// deb_vec(v);
// cout<<endl;
// deb_vec(x);
for (int i = 0; i < n; i++)
{
mp[abs(x[i])] += v[i];
}
for(auto val : mp){
// cout<<val.first<<" "<<val.second<<endl;
dam_given += val.second;
dam_avail = (k*val.first);
// dam_avail -= dam_given;
if (dam_avail<dam_given)
{
flag = 0;
break;
}
}
flag? cout<<"YES\n":cout<<"NO\n";
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
srand(chrono::high_resolution_clock::now().time_since_epoch().count());
int t = 1;
cin >> t;
while(t--) {
solve();
}
return 0;
}
int mpow(int base, int exp) {
base %= mod;
int result = 1;
while (exp > 0) {
if (exp & 1) result = ((ll)result * base) % mod;
base = ((ll)base * base) % mod;
exp >>= 1;
}
return result;
}
void ipgraph(int n, int m){
int i, u, v;
while(m--){
cin>>u>>v;
u--, v--;
g[u].pb(v);
g[v].pb(u);
}
}
void dfs(int u, int par){
for(int v:g[u]){
if (v == par) continue;
dfs(v, u);
}
}
1541A - Pretty Permutations | 1632C - Strange Test |
673A - Bear and Game | 276A - Lunch Rush |
1205A - Almost Equal | 1020B - Badge |
1353A - Most Unstable Array | 770A - New Password |
1646B - Quality vs Quantity | 80A - Panoramix's Prediction |
1354B - Ternary String | 122B - Lucky Substring |
266B - Queue at the School | 1490A - Dense Array |
1650B - DIV + MOD | 1549B - Gregor and the Pawn Game |
553A - Kyoya and Colored Balls | 1364A - XXXXX |
1499B - Binary Removals | 1569C - Jury Meeting |
108A - Palindromic Times | 46A - Ball Game |
114A - Cifera | 776A - A Serial Killer |
25B - Phone numbers | 1633C - Kill the Monster |
1611A - Make Even | 1030B - Vasya and Cornfield |
1631A - Min Max Swap | 1296B - Food Buying |